<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${BaseContext }">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!-- 引入bootstrap -->
<link rel="stylesheet" type="text/css"
	href="static/css/bootstrap.min.css">
<!-- 引入JQuery  bootstrap.js-->
<script src="static/js/jquery-3.2.1.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>
</head>
<body>
	<!-- 顶栏  -->
	<jsp:include page="include/top.jsp"></jsp:include>
	<div class="container" id="content">
		<div class="row">
			<div class="panel panel-default">
				<div class="panel-heading">
					<a href="admin/index.do">首页</a> / <a href="javascript:;">添加用户</a>
				</div>
				<div class="panel-body">

					<div class="col-md-offset-3 col-md-6">
						<form class="form-horizontal" id="teacherForm" action="admin/add.do" method="post">
							<div class="form-group">
								<label for="inputUsername" class="col-sm-2 control-label">用户名</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="inputEmail3"
										placeholder="username" name="username">
								</div>
							</div>
							<div class="form-group">
								<label for="inputUsername" class="col-sm-2 control-label">真实性名</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="inputEmail3"
										placeholder="username" name="realname">
								</div>
							</div>
							<div class="form-group">
								<label for="inputPassword3" class="col-sm-2 control-label">密码</label>
								<div class="col-sm-10">
									<input type="password" class="form-control" id="inputPassword3"
										placeholder="Password" name="password">
								</div>
							</div>
							
							<div class="form-group">
								<label for="inputRole" class="col-sm-2 control-label">角色</label>
								<div class="col-sm-10">
									<select class="form-control" name="role" id="roleSelections">
									  <option value="0">请选择角色</option>
									  <option value="1">管理员</option>
									  <option value="2">教师</option>
									  <option value="3">专家</option>
									</select>
								</div>
							</div>
							
							<div class="form-group">
								<div class="col-sm-offset-2 col-sm-10">
									<button type="button" id="sub-btn" class="btn btn-default">保存</button>
									<button type="button" id="back-btn" class="btn btn-default">返回</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
		<!-- footer -->
	<jsp:include page="include/footer.jsp"></jsp:include>
</body>
<script type="text/javascript">
	$(function(){
		$('#sub-btn').on('click',function(){
			var role = $('#roleSelections').val();
			if(role==0){
				alert('请选择角色');
			}else{
					$('#teacherForm').submit();
				}
		});

		$('#back-btn').on('click',function(){
			window.location.href="admin/manageTeacher.do";
		});
		
	});
		
</script>
</html>